minetest.register_on_player_hpchange(function(player, hp_change, reason)
    if reason.type=="fall" then
        local pos = player:get_pos()
        while(minetest.get_node(pos).name=="air") do
            pos = vector.subtract(pos, vector.new(0,1,0))
        end
        if minetest.get_node(pos).name=="default:water_source" or minetest.get_node(pos).name=="default:water_flowing" then
            return 0
        end
    end
    return hp_change
end
, true)